import {defZFormFieldCom} from "../../../zform/render.js";

export function installExtCus() {
  defZFormFieldCom('CusInputTag', {
    create(propConfig, props) {
      let slots = propConfig?.ui?.slots ?? {}
      return {
        template: `
        <zw-layout class="cus-input-tag" :class="ui.className" row>${slots?.afterbegin ?? ''}
          <z-input-tag v-model="value"
                       @change="zfield__onInput"></z-input-tag>
          <div class="cus-input-tag__suffix">{{ui.suffix}}</div>${slots?.beforeend ?? ''}
        </zw-layout>
      `,
        mixins: [

        ],
        data() {
          if (!propConfig.ui) {
            propConfig.ui = {}
          }
          if (!propConfig.ui.widgetConfig) {
            propConfig.ui.widgetConfig = {}
          }
          return {
            ui: propConfig.ui,
            value: props?.value ?? [],
          }
        },

        methods: {

        }
      }
    }
  })
}
